package com.starbaba.util;

import java.util.ArrayList;

import org.apache.http.message.BasicNameValuePair;

import com.google.gson.JsonObject;
import com.starbaba.model.dictionary.Constant;
import com.starbaba.model.network.Phead;
import com.starbaba.model.utils.HttpConnectionUtils;
import com.starbaba.model.utils.JSONUtils;

public class PhoneOrderUtil {

	public static String rechargePhoneFee(String number, int amount,
			long orderid, int busi_type, String prd_id, String memo,
			String callback) {

		JsonObject request = new JsonObject();
		request.addProperty("number", number);
		request.addProperty("amount", amount);
		request.addProperty("orderid", orderid);
		request.addProperty("busi_type", busi_type);
		request.addProperty("prd_id", prd_id);
		request.addProperty("memo", memo);
		request.addProperty("callback", callback);
		request.add("phead", JSONUtils.toJsonObject(new Phead()));
		ArrayList<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
		list.add(new BasicNameValuePair("data", request.toString()));
		return HttpConnectionUtils.connectionZip(
				Constant.COMMON_HOST + "/loan_utils/common?funid=2",
				HttpConnectionUtils.POST, list);

	}

	public static String rechargePhoneData(String number, int amount,
			long orderid, int busi_type, String prd_id, String memo,
			String callback) {
		JsonObject request = new JsonObject();
		request.addProperty("number", number);
		request.addProperty("amount", amount);
		request.addProperty("orderid", orderid);
		request.addProperty("busi_type", busi_type);
		request.addProperty("prd_id", prd_id);
		request.addProperty("memo", memo);
		request.addProperty("callback", callback);
		request.add("phead", JSONUtils.toJsonObject(new Phead()));
		ArrayList<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
		list.add(new BasicNameValuePair("data", request.toString()));
		return HttpConnectionUtils.connectionZip(
				Constant.COMMON_HOST + "/loan_utils/common?funid=3",
				HttpConnectionUtils.POST, list);

	}
}
